<template>
  <div class="status-indicator">
    <span 
      class="status-dot"
      :class="statusClass"
    ></span>
    <span class="status-text">
      {{ statusText }}
    </span>
  </div>
</template>

<script lang="ts" setup>
import { computed } from 'vue';

interface Props {
  status: number | boolean;
  activeText?: string;
  inactiveText?: string;
}

const props = withDefaults(defineProps<Props>(), {
  activeText: 'Active',
  inactiveText: 'Inactive'
});

// 计算状态类名
const statusClass = computed(() => {
  const isActive = typeof props.status === 'boolean' ? props.status : props.status === 1;
  return isActive ? 'status-active' : 'status-inactive';
});

// 计算状态文本
const statusText = computed(() => {
  const isActive = typeof props.status === 'boolean' ? props.status : props.status === 1;
  return isActive ? props.activeText : props.inactiveText;
});
</script>

<style lang="scss" scoped>
.status-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
  
  .status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
    
    &.status-active {
      background-color: #10B981; // 绿色 - 激活状态
    }
    
    &.status-inactive {
      background-color: #EF4444; // 红色 - 非激活状态
    }
  }
  
  .status-text {
    font-size: 13px;
    color: #374151;
    font-weight: 500;
  }
}
</style>
